import jsonschema

# 校验规则
schema = {
    "type": "object",
    "properties": {
        "success": {"const": True},    # {"type": "boolean"}可以被{"const": True}替代
        "code": {"const": 10000},      # {"type": "boolean"}是总的概括，{"const": True}是具体的值
        "message": {"const": "操作成功"},
    },
    "required":["success","code","message"]   # 描述data的key
}

# 数据
data = {
    "success": True,
    "code": 10000,
    "message": "操作成功"
}

# 校验
ret = jsonschema.validate(instance=data, schema=schema)
print(ret)  # None 表示正确
